<link href="${rc.getContextPath()}/static/css/dwzCustomCss/dwz.custom.css?v=${ver}" rel="stylesheet" type="text/css">
<form method="post" action="${rc.getContextPath()}/role/saveAuthorizeRole" class=" pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
    <div class="pageContent">
        <div class="pageFormContent">
            <fieldset>
                <input type="hidden" name="navTabId" value="${navTabId!''}"> <input type="hidden" name="id" value="<#if (role.roleCode)??>${role.roleCode!''}</#if>"> <input type="hidden" id="user" name="user" value="${user!''}"> <input type="hidden" id="menu" name="menu" value="${menu!''}">
                <dl class="nowrap">
                    <div style="float: left; height: 25px; width: 300px;">
                        <label style="width: 60px"><@label key="roleCode.C,colon">角色编码：</@label></label> <input class="required alphanumeric toUp" name="roleCode" value="<#if (role.roleCode)??>${role.roleCode!''}</#if>" size="20" type="text" maxlength="40" readonly="readonly"/>
                    </div>
                    <div style="float: left; height: 25px; width: 300px;">
                        <label style="width: 60px"><@label key="roleText.C,colon">角色描述：</@label></label> <input class="required" name="roleText" value="<#if (role.roleText)??>${role.roleText!''}</#if>" size="20" type="text" maxlength="60" readonly="readonly"/>
                    </div>
                </dl>
                <dl class="nowrap">
                    <dd>
                        <div class="tabs" currentIndex="0" eventType="click" style="width: 615px">
                            <div class="tabsHeader">
                                <div class="tabsHeaderContent">
                                    <ul>
                                        <li><a href="javascript:;"><span><@label key="authority.C">权限</@label></span> </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="tabsContent">
                                <div style="height: 243px;overflow: hidden;">
                                    <div id="menuTree" style="height: 243px;overflow: auto;">
                                        <ul id="tree" class="tree treeFolder treeCheck expand canOnlyCheckParent" oncheck="oncheck">
                                            <#list menus as tree>
                                            <li><a tvalue="${tree.menuCode}" tname="${tree.menuText}"<#if (tree.isChecked)?? && (tree.isChecked == 1)> checked="true"</#if>>${tree.menuText}</a> 
                                            <#if tree.children?? &&tree.children?size gt 0>
                                                <ul><@bpTree children=tree.children />
                                                </ul>
                                                 </#if>
                                                 </li>
                                         </#list>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="tabsFooter">
                                <div class="tabsFooterContent"></div>
                            </div>
                        </div>
                    </dd>
                </dl>
            </fieldset>
        </div>
        <#if (role.roleCode)??> <#assign createInfo=role/> <#include "/common/createInfo.html"> </#if>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive" id="save">
                        <div class="buttonContent">
                            <button type="submit" onclick="c()"><@label key="save.B">保存</@label></button>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="buttonActiveGrey">
                        <div class="buttonContent">
                            <button type="button" class="close"><@label key="cancel.B">取消</@label></button>
                        </div>
                    </div></li>
            </ul>
        </div>
    </div>
    <#macro bpTree children>
     <#if children?? && children?size gt 0> 
        <#list children as child>
        <li><a tvalue="${child.menuCode}" tname="${child.menuText}"<#if (child.isChecked)?? && (child.isChecked == 1)> checked="true"</#if>>${child.menuText}</a>
        <#if child.children?? &&child.children?size gt 0>
        <ul><@bpTree children=child.children />
        </ul> 
        </#if>
        </li> 
        </#list> 
        </#if> 
        </#macro>
</form>



<script type="text/javascript">
	var $p=$.pdialog.getCurrent();
	
	function oncheck(){    
	   $('#menuTree div[class="ckbox indeterminate"]',$.pdialog.getCurrent()).each(function (i, e) {
	    var obj = $(e);
	    var a= obj.find("input[type='checkbox']",$.pdialog.getCurrent());
	    a.attr("checked","checked");
	   });
	}
	
	function c() {
	    var menu = "";
	    $('#menuTree input[type="checkbox"]:checked',$.pdialog.getCurrent()).each(function (i, e) {
	        menu+=e.value+",";
	    });    
	    if (menu.length > 1) {
	        menu = menu.substring(0, menu.length - 1);
	    }
	    $("#menu").val(menu);
	
	}
</script>
